package com.spica.platform.kafka.consumer.properties;

import lombok.Getter;
import lombok.Setter;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.Arrays;
import java.util.List;

/**
 * kafka消费者配置
 */
@Setter
@Getter
@ConfigurationProperties(prefix = "spica.kafka.consumer")
public class KafkaConsumerProperties {

    private String bootstrapServers;

    private long timeout = 3000L;

    private boolean enableAutoCommit = false;

    private String autoOffsetReset = "earliest";

    private String keyDeserializer = "org.apache.kafka.common.serialization.StringDeserializer";

    private String valueDeserializer = "org.apache.kafka.common.serialization.StringDeserializer";

    private AutoRestart autoRestart = new AutoRestart();


    private Email email = new Email();

    @Setter
    @Getter
    public static class AutoRestart {
        private boolean enabled = true;
        private int interval = 20;
    }

    @Setter
    @Getter
    public static class Email {
        private boolean enabled = true;
        private Smtp smtp = new Smtp();
        private int emailQueueSize = 100;

        @Setter
        @Getter
        public static class Smtp {
            private String host = "";
            private int port = 465;
            private String username = "";
            private String password = "";
            private boolean useSSL = true;
            private boolean debugMode = false;
            private String from = "";
            private List<String> to = Arrays.asList("");

        }
    }
}
